#!/bin/sh

# remove.sh
# wiSync
#
# Created by Youssef Francis on 12/21/07.
# Copyright 2007 iFrancis Development Team. All rights reserved.

	echo "spawn ssh root@${phoneip}" > "${rsrcpath}/exp_ssh3.sh"
	echo expect '"(yes/no)?"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"yes\r"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"password:"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'${rootpass_old}"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'crontab -r"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'mv ~/.ssh/known_hosts ~/.ssh/b_known_hosts"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'mv ~/.ssh/authorized_keys ~/.ssh/b_authorized_keys"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'rm -rf /Applications/Scripts"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'rm -rf /Applications/wiToggle.app"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'killall SpringBoard"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect '"#"' >> "${rsrcpath}/exp_ssh3.sh"
	echo send '"'exit"\r"'"' >> "${rsrcpath}/exp_ssh3.sh"
	echo expect eof >> "${rsrcpath}/exp_ssh3.sh"
echo "mv ~/.ssh/known_hosts ~/.ssh/b_known_hosts" > "${rsrcpath}/run_exp_ssh3.sh"
echo "mv ~/.ssh/authorized_keys ~/.ssh/b_authorized_keys" >> "${rsrcpath}/run_exp_ssh3.sh"
echo "mv ~/.ssh/bknown_hosts ~/.ssh/known_hosts" > "${rsrcpath}/run_exp_ssh3.sh"
echo "mv ~/.ssh/bauthorized_keys ~/.ssh/authorized_keys" >> "${rsrcpath}/run_exp_ssh3.sh"
echo "expect -f '${rsrcpath}/exp_ssh3.sh'" >> "${rsrcpath}/run_exp_ssh3.sh"
chmod +x "${rsrcpath}/run_exp_ssh3.sh"